//
//  UIView+DoitInit.h
//  Pods
//
//  Created by Apple on 2022/11/4.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIView (DoitInit)

+ (UIView * _Nonnull (^)(void))yc_init;
+ (UIView * _Nonnull (^)(CGRect))yc_initWithframe;
+ (UIView * _Nonnull (^)(UIColor *))yc_lineViewWithColor;
+ (UIView * _Nonnull (^)(UIColor *, CGFloat))yc_lineViewWithColorAndHeight;
- (UIView * _Nonnull (^)(CGRect))yc_frame;
- (UIView * _Nonnull (^)(UIColor *))yc_backgroundColor;
- (UIView * _Nonnull (^)(UIViewContentMode))yc_contentMode;
- (UIView * _Nonnull (^)(BOOL))yc_hidden;
- (UIView * _Nonnull (^)(BOOL))yc_userInteractionEnabled;
- (UIView * _Nonnull (^)(CGFloat))yc_cornerRadius;
- (UIView * _Nonnull (^)(CGFloat, UIColor *))yc_borderWidthAndColor;
- (UIView * _Nonnull (^)(dispatch_block_t))yc_action;

@end



@interface UIImageView (DoitInit)

+ (UIImageView * _Nonnull (^)(UIImage *))yc_initWithImage;
+ (UIImageView * _Nonnull (^)(void))yc_init;
- (UIImageView * _Nonnull (^)(UIImage *))yc_image;

@end



@interface UILabel (DoitInit)

+ (UILabel * _Nonnull (^)(UIFont *font, UIColor *textColor, NSString *text))yc_initLabel;
+ (UILabel * _Nonnull (^)(UIFont *, UIColor *))yc_initWithFontAndColor;
+ (UILabel * _Nonnull (^)(void))yc_init;
- (UILabel * _Nonnull (^)(NSString *))yc_text;
- (UILabel * _Nonnull (^)(UIFont *))yc_font;
- (UILabel * _Nonnull (^)(UIColor *))yc_textColor;
- (UILabel * _Nonnull (^)(NSTextAlignment))yc_textAlignment;
- (UILabel * _Nonnull (^)(NSInteger))yc_numberOfLines;

@end



@interface UITextField (DoitInit)

+ (UITextField * _Nonnull (^)(UIFont *, UIColor *, NSString *, NSString *))yc_initTextField;
+ (UITextField * _Nonnull (^)(UIFont *, UIColor *))yc_initWithFontAndColor;
+ (UITextField * _Nonnull (^)(void))yc_init;
- (UITextField * _Nonnull (^)(NSString *))yc_text;
- (UITextField * _Nonnull (^)(NSAttributedString *))yc_attributedText;
- (UITextField * _Nonnull (^)(NSString *))yc_placeholder;
- (UITextField * _Nonnull (^)(UIFont *))yc_font;
- (UITextField * _Nonnull (^)(UIColor *))yc_textColor;
- (UITextField * _Nonnull (^)(NSTextAlignment))yc_textAlignment;
- (UITextField * _Nonnull (^)(UITextBorderStyle))yc_borderStyle;
- (UITextField * _Nonnull (^)(id<UITextFieldDelegate>))yc_delegate;

@end



@interface UITextView (DoitInit)

+ (UITextView * _Nonnull (^)(UIFont *, UIColor *, NSString *))yc_initTextView;
+ (UITextView * _Nonnull (^)(UIFont *, UIColor *))yc_initWithFontAndColor;
+ (UITextView * _Nonnull (^)(void))yc_init;
- (UITextView * _Nonnull (^)(BOOL))yc_editable;
- (UITextView * _Nonnull (^)(NSString *))yc_text;
- (UITextView * _Nonnull (^)(UIFont *))yc_font;
- (UITextView * _Nonnull (^)(UIColor *))yc_textColor;
- (UITextView * _Nonnull (^)(NSTextAlignment))yc_textAlignment;
- (UITextView * _Nonnull (^)(id<UITextViewDelegate>))yc_delegate;

@end



@interface UIButton (DoitInit)

+ (UIButton * _Nonnull (^)(NSString *, UIFont *, UIColor *))yc_initWithTitle;
+ (UIButton * _Nonnull (^)(UIImage *, UIImage *))yc_initWithStateImage;
+ (UIButton * _Nonnull (^)(UIImage *))yc_initWithImage;
+ (UIButton * _Nonnull (^)(void))yc_init;
- (UIButton * _Nonnull (^)(UIFont *))yc_font;
- (UIButton * _Nonnull (^)(NSString *))yc_normalTitle;
- (UIButton * _Nonnull (^)(NSString *))yc_selectedTitle;
- (UIButton * _Nonnull (^)(NSString *))yc_highlightedTitle;
- (UIButton * _Nonnull (^)(NSString *))yc_disabledTitle;
- (UIButton * _Nonnull (^)(UIImage *))yc_normalImage;
- (UIButton * _Nonnull (^)(UIImage *))yc_selectedImage;
- (UIButton * _Nonnull (^)(UIImage *))yc_highlightedImage;
- (UIButton * _Nonnull (^)(UIImage *))yc_disabledImage;
- (UIButton * _Nonnull (^)(UIColor *))yc_normalTitleColor;
- (UIButton * _Nonnull (^)(UIColor *))yc_selectedTitleColor;
- (UIButton * _Nonnull (^)(UIColor *))yc_highlightedTitleColor;
- (UIButton * _Nonnull (^)(UIColor *))yc_disabledTitleColor;
- (UIButton * _Nonnull (^)(id, SEL))yc_targetAction;

@end



@interface UIControl (DoitInit)

- (UIControl * _Nonnull (^)(BOOL))yc_enabled;
- (UIControl * _Nonnull (^)(BOOL))yc_selected;
- (UIControl * _Nonnull (^)(BOOL))yc_highlighted;
- (UIControl * _Nonnull (^)(UIControlContentVerticalAlignment))yc_contentVerticalAlignment;
- (UIControl * _Nonnull (^)(UIControlContentHorizontalAlignment))yc_contentHorizontalAlignment;

@end



@interface UITableView (DoitInit)

+ (UITableView * _Nonnull (^)(CGRect, UITableViewStyle))yc_initWithStyle;
+ (UITableView * _Nonnull (^)(void))yc_init;
- (UITableView * _Nonnull (^)(id target))yc_delegate;
- (UITableView * _Nonnull (^)(UIView *))yc_tableHeaderView;
- (UITableView * _Nonnull (^)(UIView *))yc_tableFooterView;
- (UITableView * _Nonnull (^)(CGFloat))yc_rowHeight;
- (UITableView * _Nonnull (^)(CGFloat))yc_sectionHeaderHeight;
- (UITableView * _Nonnull (^)(CGFloat))yc_sectionFooterHeight;
- (UITableView * _Nonnull (^)(CGFloat))yc_estimatedRowHeight;
- (UITableView * _Nonnull (^)(CGFloat))yc_estimatedSectionHeaderHeight;
- (UITableView * _Nonnull (^)(CGFloat))yc_estimatedSectionFooterHeight;
- (UITableView * _Nonnull (^)(void))yc_noneSeparator;
- (UITableView * _Nonnull (^)(UIColor *))yc_separatorColor;
- (UITableView * _Nonnull (^)(UIEdgeInsets))yc_contentInset;
- (UITableView * _Nonnull (^)(CGFloat))yc_contentInsetInTop;
- (UITableView * _Nonnull (^)(UIEdgeInsets))yc_separatorInset;
- (UITableView * _Nonnull (^)(CGFloat, CGFloat))yc_separatorLeftAndRight;
- (UITableView * _Nonnull (^)(NSString *))yc_registerClassWithCellName;

@end



typedef NS_ENUM(NSInteger, YCConstraintPosition) {
    YCConstraintPosition_Top,
    YCConstraintPosition_Bottom,
    YCConstraintPosition_Left,
    YCConstraintPosition_Right,
    YCConstraintPosition_CenterX,
    YCConstraintPosition_CenterY,
    YCConstraintPosition_Center,
    YCConstraintPosition_Width,
    YCConstraintPosition_Height,
    YCConstraintPosition_Size
};

typedef NS_ENUM(NSInteger, YCConstraintCorner) {
    YCConstraintCorner_Left_Top,
    YCConstraintCorner_Left_Bottom,
    YCConstraintCorner_Left_Center,
    YCConstraintCorner_Right_Top,
    YCConstraintCorner_Right_Bottom,
    YCConstraintCorner_Right_Center,
    YCConstraintCorner_Center_Top,
    YCConstraintCorner_Center_Bottom
};

typedef NS_ENUM(NSInteger, YCConstraintSpace) {
    YCConstraintSpace_Top,
    YCConstraintSpace_Bottom,
    YCConstraintSpace_Left,
    YCConstraintSpace_Right,
    YCConstraintSpace_Width,
    YCConstraintSpace_Height,
    YCConstraintSpace_Width_Height,
    YCConstraintSpace_Left_Top,
    YCConstraintSpace_Left_Bottom,
    YCConstraintSpace_Left_Right,
    YCConstraintSpace_Right_Top,
    YCConstraintSpace_Right_Bottom,
    YCConstraintSpace_Top_Bottom
};


@interface UIView (Constraints)

/// 相对父视图的边距
- (UIView * _Nonnull (^)(UIEdgeInsets))yc_constraint_make_edge;
/// 单个方位 约束相同
- (UIView * _Nonnull (^)(YCConstraintPosition, UIView *))yc_constraint_make_same;
/// 角落 布局
- (UIView * _Nonnull (^)(YCConstraintCorner, CGRect))yc_constraint_make_corner;
/// 间距
- (UIView * _Nonnull (^)(YCConstraintPosition, UIView *, CGFloat))yc_constraint_make_space;
/// 偏移量 一个左边对应另一个的也是左边 表示平移了多少
- (UIView * _Nonnull (^)(YCConstraintPosition, UIView *, CGFloat))yc_constraint_make_offset;
/// 比例或倍数
- (UIView * _Nonnull (^)(UIView *, CGFloat))yc_constraint_make_multiple_width;
- (UIView * _Nonnull (^)(UIView *, CGFloat))yc_constraint_make_multiple_height;
// 单个View  宽高比  宽/高
- (UIView * _Nonnull (^)(CGFloat))yc_constraint_make_aspectRatio;
/// 单个View直接赋值距离 (value > 0)
- (UIView * _Nonnull (^)(YCConstraintSpace, CGFloat))yc_constraint_make_equal;

@end

NS_ASSUME_NONNULL_END
